package com.xius.controller;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageInfo;
import com.xius.common.ApiController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import com.xius.common.R;
import com.xius.service.SecUserService;
import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/*
*
 *
* @author makejava
* @since 2020-06-12 17:14:18
*/
@RestController
@RequestMapping("/api/secUser")
public class SecUserController extends ApiController {
    
    /*
    *
     * 服务对象
    */
    @Resource
    private SecUserService secUserService;
    @PostMapping("/queryAll")
    @ApiOperationSupport(params = @DynamicParameters(
                name = "SecUserControllerQueryAll",
                properties = {
    @DynamicParameter(name = "secUserId", value = "主键"),@DynamicParameter(name = "secUserUsername", value = "用户名"),@DynamicParameter(name = "secUserPassword", value = "密码"),@DynamicParameter(name = "secUserNickname", value = "昵称"),@DynamicParameter(name = "secUserPhone", value = "手机"),@DynamicParameter(name = "secUserEmail", value = "邮箱"),@DynamicParameter(name = "secUserBirthday", value = "生日"),@DynamicParameter(name = "secUserSex", value = "性别，男-1，女-2"),@DynamicParameter(name = "secUserStatus", value = "状态，启用-1，禁用-0"),@DynamicParameter(name = "secUserCreateTime", value = "创建时间"),@DynamicParameter(name = "secUserUpdateTime", value = "更新时间"),
    }
    ))
    public R queryAll(@RequestBody Map<String,Object> map) {
        R<PageInfo<List<Map<String, Object>>>> success = success(secUserService.queryAll(map));
        System.out.println(JSONUtil.toJsonStr(success));
        return success;
    }

    @PostMapping("/queryAllJoin")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerQueryAllJoin",
                    properties = {
    @DynamicParameter(name = "secUserId", value = "主键"),@DynamicParameter(name = "secUserUsername", value = "用户名"),@DynamicParameter(name = "secUserPassword", value = "密码"),@DynamicParameter(name = "secUserNickname", value = "昵称"),@DynamicParameter(name = "secUserPhone", value = "手机"),@DynamicParameter(name = "secUserEmail", value = "邮箱"),@DynamicParameter(name = "secUserBirthday", value = "生日"),@DynamicParameter(name = "secUserSex", value = "性别，男-1，女-2"),@DynamicParameter(name = "secUserStatus", value = "状态，启用-1，禁用-0"),@DynamicParameter(name = "secUserCreateTime", value = "创建时间"),@DynamicParameter(name = "secUserUpdateTime", value = "更新时间"),
    }
    ))
    public R queryAllJoin(@RequestBody Map<String,Object> map) {
        return success(secUserService.queryAllJoin(map));
    }
    @PostMapping("/queryById")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerQueryById",
                    properties = {
    @DynamicParameter(name = "secUserId", value = "主键"),@DynamicParameter(name = "secUserUsername", value = "用户名"),@DynamicParameter(name = "secUserPassword", value = "密码"),@DynamicParameter(name = "secUserNickname", value = "昵称"),@DynamicParameter(name = "secUserPhone", value = "手机"),@DynamicParameter(name = "secUserEmail", value = "邮箱"),@DynamicParameter(name = "secUserBirthday", value = "生日"),@DynamicParameter(name = "secUserSex", value = "性别，男-1，女-2"),@DynamicParameter(name = "secUserStatus", value = "状态，启用-1，禁用-0"),@DynamicParameter(name = "secUserCreateTime", value = "创建时间"),@DynamicParameter(name = "secUserUpdateTime", value = "更新时间"),
    }
    ))
    public R queryById(@RequestBody Map<String,Object> map) {
        return success(secUserService.queryById(map));
    }
    @PostMapping("/insert")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerInsert",
                    properties = {
    @DynamicParameter(name = "secUserId", value = "主键"),
                            @DynamicParameter(name = "secUserUsername", value = "用户名"),
                            @DynamicParameter(name = "secUserPassword", value = "密码"),
                            @DynamicParameter(name = "secUserNickname", value = "昵称"),
                            @DynamicParameter(name = "secUserPhone", value = "手机"),
                            @DynamicParameter(name = "secUserEmail", value = "邮箱"),
                            @DynamicParameter(name = "secUserBirthday", value = "生日"),
                            @DynamicParameter(name = "secUserSex", value = "性别，男-1，女-2"),
                            @DynamicParameter(name = "secUserStatus", value = "状态，启用-1，禁用-0"),
                            @DynamicParameter(name = "secUserCreateTime", value = "创建时间"),
                            @DynamicParameter(name = "secUserUpdateTime", value = "更新时间"),
    }
    ))
    public R insert(@RequestBody Map<String,Object> map) {
        return success(this.secUserService.insert(map));
    }
    @PostMapping("/inserts")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerInserts",
                    properties = {
    @DynamicParameter(name = "secUserId", value = "主键"),@DynamicParameter(name = "secUserUsername", value = "用户名"),@DynamicParameter(name = "secUserPassword", value = "密码"),@DynamicParameter(name = "secUserNickname", value = "昵称"),@DynamicParameter(name = "secUserPhone", value = "手机"),@DynamicParameter(name = "secUserEmail", value = "邮箱"),@DynamicParameter(name = "secUserBirthday", value = "生日"),@DynamicParameter(name = "secUserSex", value = "性别，男-1，女-2"),@DynamicParameter(name = "secUserStatus", value = "状态，启用-1，禁用-0"),@DynamicParameter(name = "secUserCreateTime", value = "创建时间"),@DynamicParameter(name = "secUserUpdateTime", value = "更新时间"),
    }
    ))
    public R inserts(@RequestBody List<Map<String,Object>> list) {
        return success(this.secUserService.inserts(list));
    }
    @PostMapping("/update")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerUpdate",
                    properties = {
    @DynamicParameter(name = "secUserId", value = "主键"),@DynamicParameter(name = "secUserUsername", value = "用户名"),@DynamicParameter(name = "secUserPassword", value = "密码"),@DynamicParameter(name = "secUserNickname", value = "昵称"),@DynamicParameter(name = "secUserPhone", value = "手机"),@DynamicParameter(name = "secUserEmail", value = "邮箱"),@DynamicParameter(name = "secUserBirthday", value = "生日"),@DynamicParameter(name = "secUserSex", value = "性别，男-1，女-2"),@DynamicParameter(name = "secUserStatus", value = "状态，启用-1，禁用-0"),@DynamicParameter(name = "secUserCreateTime", value = "创建时间"),@DynamicParameter(name = "secUserUpdateTime", value = "更新时间"),
    }
    ))
    public R update(@RequestBody Map<String,Object> map) {
        return success(this.secUserService.update(map));
    }
    @PostMapping("/deleteByIds")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerDeleteByIds",
                    properties = {
    }
    ))
    public R deleteByIds(@RequestBody Map<String,Object> map) {
        return success(this.secUserService.deleteByIds(map));
    }
    @PostMapping("/deleteById")
    @ApiOperationSupport(params = @DynamicParameters(
                    name = "SecUserControllerDeleteById",
                    properties = {
    }
    ))
    public R deleteById(@RequestBody Map<String,Object> map) {
        return success(this.secUserService.deleteById(map));
    }
}
